import {tokens} from "./baseToken"

const request = (params) =>{
  let header = {
    'content-type': 'application/json;charset=UTF-8' ,
    token:tokens
  }
  return new Promise((reject,respose)=>{
    wx.request({
      url: "http://localhost:3000" + params.url,
      method:params.method || "GET",
      data:params.data || {},
      header:header || {},
      success(res){
        reject(res)  
      },
      fail(error){
        respose(error)
      }
    })
  })
}

export default request